﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Domain.MainModule.Entities;
using Infraestructure.CrossCutting.IoC;
using Application.MainModule.CountriesManagement;
using Application.MainModule.CommonManagement;
using Application.MainModule.AddressManagement;
using Application.MainModule.BankAccountsManagement;
using Application.MainModule.PhonesManagement;
using Application.MainModule.VirtualAccountsManagement;
using Application.MainModule.IdentitiesManagement;
using Application.MainModule.CreditCardManagement;

namespace Presentation.Web.MVC.Client.Controllers
{
    [HandleError]
    public class CommonController
    {
        /// <summary>
        /// Get all Countries
        /// </summary>
        public static IEnumerable<Country> Countries
        {
            get
            {
                ICountryManagementService _countryService = IoCFactory.Instance.CurrentContainer.Resolve<ICountryManagementService>();
                return _countryService.GetAll();
            }
        }

        /// <summary>
        /// Gel all Genders
        /// </summary>
        public static IEnumerable<Gender> Genders
        {
            get
            {
                ICommonManagementService _commonService = IoCFactory.Instance.CurrentContainer.Resolve<ICommonManagementService>();
                return _commonService.GetGenders();
            }
        }

        /// <summary>
        /// Get all Marital status
        /// </summary>
        public static IEnumerable<MaritalStatus> MaritalStatus
        {
            get
            {
                ICommonManagementService _commonService = IoCFactory.Instance.CurrentContainer.Resolve<ICommonManagementService>();
                return _commonService.GetMaritalStatus();
            }
        }

        /// <summary>
        /// Get all bank account types.
        /// </summary>
        public static IEnumerable<BankAccountType> BankAccountTypes
        {
            get
            {
                IBankAccountManagementService _commonService = IoCFactory.Instance.CurrentContainer.Resolve<IBankAccountManagementService>();
                return _commonService.GetAllBankAccountTypes();
            }
        }

        public static List<Bank> Banks
        {
            get
            {
                IBankAccountManagementService _commonService = IoCFactory.Instance.CurrentContainer.Resolve<IBankAccountManagementService>();
                return _commonService.GetAllBanks();
            }
        }

        public static List<Address> GetAddresses(Guid UserId)
        {
            IAddressManagementService _commonService = IoCFactory.Instance.CurrentContainer.Resolve<IAddressManagementService>();
            return _commonService.FindAddressByUserId(UserId);
        }

        public static List<Phone> GetPhones(Guid UserId)
        {
            IPhoneManagementService _commonService = IoCFactory.Instance.CurrentContainer.Resolve<IPhoneManagementService>();
            return _commonService.FindPhoneByUserId(UserId);
        }

        public static List<VirtualAccount> GetVirtualAccounts(Guid UserId)
        {
            IVirtualAccountManagementService _service = IoCFactory.Instance.CurrentContainer.Resolve<IVirtualAccountManagementService>();
            return _service.FindVirtualAccounts(UserId);
        }

        public static List<Identity> GetIdentities(Guid UserId)
        {
            IIdentityManagementService _service = IoCFactory.Instance.CurrentContainer.Resolve<IIdentityManagementService>();
            return _service.FindIdentityByUserId(UserId);
        }
        
        public static List<CreditCard> GetCreditCards(Guid UserId)
        {
            ICreditCardManagementService _service = IoCFactory.Instance.CurrentContainer.Resolve<ICreditCardManagementService>();
            return _service.FindCreditCardByUserId(UserId);
        }


    }
}